﻿using System.Diagnostics.CodeAnalysis;

namespace Loki.Utils
{
    public class ConcurrentListNode<T> : IListNode<T>
    {
        [SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1401:FieldsMustBePrivate", Justification = "must be field to support interlock read/write")]
        internal bool SYN_Deleted;

        [SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1401:FieldsMustBePrivate", Justification = "must be field to support interlock read/write")]
        internal bool SYN_Read;

        public long Version { get; private set; }

        public T Value { get; private set; }

        public ConcurrentListNode<T> Next { get; set; }

        public ConcurrentListNode<T> Previous { get; set; }

        public ConcurrentListNode(T P_Value, long P_Version)
        {
            SYN_Deleted = false;
            SYN_Read = false;
            Value = P_Value;
            Version = P_Version;
        }
    }
}
